package com.hefei.garden.controller;

import com.hefei.garden.config.netty.server.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/nettyServer")
@Controller
public class NettyServerController {

    @Autowired
    private NettyServer nettyServer;

    @RequestMapping(value = "/start", method = RequestMethod.GET)
    @ResponseBody
    public String initNettyServer() {
        nettyServer.initNettyServer();
        return "success";
    }

    @RequestMapping(value = "/shutdown", method = RequestMethod.GET)
    @ResponseBody
    public String destroyNettyServer() {
        nettyServer.destroyNettyServer();
        return "success";
    }

}

